import xlrd
import sys
import csv
import pandas as pd

def xlsx_to_csv(excelfile, csvfile):
    workbook = xlrd.open_workbook(excelfile)
    table = workbook.sheet_by_index(0)
    with open(csvfile, 'w', encoding='utf-8') as f:
        write = csv.writer(f)
        for row_num in range(table.nrows):
            row_value = table.row_values(row_num)
            write.writerow(row_value)

def xlsx_to_csv_new(excelfile, csvfile):
    data_xls = pd.read_excel(excelfile, index_col=0)
    data_xls.to_csv(csvfile, encoding='utf-8')

if __name__ == '__main__':
    # xlsx_to_csv(sys.argv[1], sys.argv[2])
    xlsx_to_csv_new(sys.argv[1], sys.argv[2])
